import java.util.Scanner;
//题目地址：https://www.acwing.com/problem/content/submission/95/
public class 递归实现组合型枚举 {
    private static int N = 30;
    private static int[] way = new int[N];
    private static int n, m;

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        m = scan.nextInt();
        //开始dfs遍历
        dfs(0, 1);
    }

    private static void dfs(int u, int start) {
        //写终止条件
        if (u == m) {
            //输出结果
            for (int i = 0; i < m; i++) {
                System.out.print(way[i] + " ");
            }
            System.out.println();
            return;
        }
        //写具体的遍历条件
        for (int i = start; i <= n; i++) {
            //填充当前位
            way[u] = i;
            //往下走
            dfs(u + 1, i + 1);
            //回来之后，要把当前位给复原
            way[u] = 0;//可省略，因为下一次会被新的数据覆盖掉
        }
    }
}
